Method, apparatus and instructions for parallel data conversions

ABSTRACT

Method, apparatus, and program means for performing a conversion. In one embodiment, a disclosed apparatus includes a destination storage location corresponding to a first architectural register. A functional unit operates responsive to a control signal, to convert a first packed first format value selected from a set of packed first format values into a plurality of second format values. Each of the first format values has a plurality of sub elements having a first number of bits The second format values have a greater number of bits. The functional unit stores the plurality of second format values into an architectural register.

RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.12/986,924, filed Jan. 7, 2011, entitled “METHOD, APPARATUS ANDINSTRUCTIONS FOR PARALLEL DATA CONVERSIONS” and claims priority to U.S.application Ser. No. 10/658,612, filed Sep. 8, 2003, entitled “METHOD,APPARATUS AND INSTRUCTIONS FOR PARALLEL DATA CONVERSIONS” which issuedon Mar. 1, 2011, as U.S. Pat. No. 7,899,855.

BACKGROUND

1. Field

The present disclosure pertains to the field of processing apparatusesand associated software and software sequences that perform mathematicaloperations.

2. Description of Related Art

Improving the performance of computer or other processing systemsgenerally improves overall throughput and/or provides a better userexperience. One area of concern is processing of image data. As computerand other processing systems handle larger amounts of video or imagedata, techniques to expedite such processing grow in importance.

Video data may be represented in the form of pixels. One example formatfor a pixel is the Red, Green, Blue (RGB) format. The number of bitsused to represent a pixel may vary according to the particular system.For example, a twenty-four bit RGB representation may dedicate eightbits to each component. The RGBA format is another popular format thatincludes “alpha” information, a transparency indicator. An alpha channelnumber specifies the transparency of the particular pixel in a rangefrom 0 (fully opaque) to 255 (completely transparent). Other formats mayalso be used such as the luminance (YUV) format or any other known orotherwise available format.

Processing of pixels may be performed in formats other than their pixel(e.g., integer) representation. For example, to perform somemathematical operations on pixel values, conversion to a floating pointrepresentation first may be desirable. Various high level languages(e.g., C, Java, etc.) may provide instructions can be used to convert apixel value in an integer format to another type of format. These highlevel languages, however, by their nature are broken down into nativeinstruction sequences and may not guaranty parallelism or efficiency incarrying out the conversion.

On the other hand, software sequences written in the native language ofa processing device may be written to perform processing of such pixels.However such native language sequences are constrained by theinstruction set of the processing device. If the processing device doesnot offer instructions to efficiently process values such as pixelvalues, then it may be difficult to construct an efficient softwaresequence. Some prior art processors include a variety of conversioninstructions. For example, the Intel Pentium® 4 Processor includesconvert instructions such as those detailed in the IA-32 IntelArchitecture Software Developer's Manual: Vol. 2: Instruction SetReference (document number 2454761). However, additional conversions maybe useful under some conditions and for some applications such asconversion and processing of image data.

BRIEF DESCRIPTION OF THE FIGURES

The present invention is illustrated by way of example and notlimitation in the Figures of the accompanying drawings.

FIG. 1 illustrates one embodiment of a processor having a conversioncapability.

FIG. 2 a illustrates further details of a processing apparatus accordingto one embodiment.

FIG. 2 b illustrates details for a functional unit that may performconversion according to one embodiment.

FIG. 2 c illustrates an instruction format according to one embodiment.

FIG. 2 d illustrates a processing apparatus according to one embodiment.

FIG. 2 e illustrates a floating point format according to oneembodiment.

FIG. 3 a illustrates conversions performed according to one embodimentof a first integer type to floating point conversion instruction.

FIG. 3 b illustrates conversions performed according to anotherembodiment of a first integer type to floating point conversioninstruction.

FIG. 4 a illustrates conversions performed according to one embodimentof a floating point to the first integer type conversion instruction.

FIG. 4 b illustrates conversions performed according to anotherembodiment of a floating point to first integer type conversioninstruction according to one embodiment.

FIG. 5 illustrates conversions performed according to one embodiment ofa second integer type to floating point conversion instruction.

FIG. 6 illustrates conversions performed according to one embodiment ofa floating point to second integer type conversion instruction.

FIG. 7 a illustrates conversions performed according to one embodimentof an alternative conversion to floating point instruction.

FIG. 7 b illustrates conversions performed according to one embodimentof an alternative conversion from floating point instruction.

FIG. 8 a illustrates conversions performed according to one embodimentof another alternative conversion to floating point instruction.

FIG. 8 b illustrates conversions performed according to one embodimentof another alternative conversion from floating point instruction.

FIG. 9 illustrates one embodiment of a system of that may utilizevarious ones of the disclosed conversion instructions.

FIG. 10 illustrates a sequence utilizing various disclosed convertinstructions according to one embodiment.

DETAILED DESCRIPTION

The following description describes embodiments of techniques forparallel data conversions. In the following description, numerousspecific details such as processor types, data types, data formats,register types, register arrangements, system configurations, and thelike are set forth in order to provide a more thorough understanding ofthe present invention. It will be appreciated, however, by one skilledin the art that the invention may be practiced without such specificdetails. Additionally, some well known structures, circuits, and thelike have not been shown in detail to avoid unnecessarily obscuring thepresent invention.

The present disclosure details various conversion and processingtechniques that may be advantageous for some types of data in someenvironments. For example, image processing and particularly pixelprocessing may be expedited using disclosed techniques in some cases. Insome such cases, an integer to floating point conversion may be used. Inother cases, disclosed conversion techniques may be used to convert froma different first format (other than integer) to a second format (otherthan floating point) or vice versa. For example, redundant numericformat or different scientific, mathematical, or other encoded forms maybe used for the source or destination format. Additionally, it isanticipated that disclosed conversion techniques may find applicabilityin a wide variety of signal processing scenarios and/or in manydifferent processing environments.

FIG. 1 illustrates one embodiment of a processor 100 that performsconversions from a first format (F1) to a second format (F2) and viceversa. The processor may be any of a variety of different types ofprocessors that execute instructions. For example, the processor may bea general purpose processor such as a processor in the Pentium®Processor Family or the Itanium® Processor Family or other processorfamilies from Intel Corporation or other processors from othercompanies. Thus, the processor may be a reduced instruction setcomputing (RISC) processor, a complex instruction set computing (CISC)processor, a very long instruction word (VLIW) processor, or any hybridor alternative processor type. Moreover, special purpose processors suchas network or communication processors, co-processors, embeddedprocessors, compression engines, graphics processors, etc., may usedisclosed techniques.

In the embodiment of FIG. 1, a first register 120 and a second register125 are provided as a portion of a register file 122. A single physicalregister may correspond to or effectively serve as an architecturalregister in embodiments that do not utilize register renamingtechniques. In embodiments utilizing register renaming techniques,typically a different physical register may hold the value of anarchitectural register at different points in time. Therefore, variousphysical registers from a set of renamed of registers may correspond tothe architectural registers at different times, with the correspondencebeing tracked via register renaming circuitry.

In some embodiments, the first register 120 and the second register maybe part of a single register set. A register set or a group of registersis a number of registers (may or may not be renamed) that are accessedin a similar manner by the instruction set. For example, a firstregister (r0) and a last register (r15) in a register set may beaddressed in the same manner by just changing the register number in theoperand specifier. In some microprocessor products from IntelCorporation (e.g., IA-32 microprocessors), register sets include integerregisters (e.g., EAX, EBX, etc.), MMX registers (mm1, mm2, etc.), XMMregisters (xmm1, xmm2, etc.), and floating point registers.

The register set may be adapted to store packed data. A packed data is adata element that comprises at least two sub elements. A register setmay be adapted to store packed data elements by permitting access to oneor various ones of the sub elements of the register. At different times,a particular register in a register set may hold packed data elements ofdifferent sizes, and all of the different individual sizes of packedelements may or may not all be accessible individually. In the exampleof FIG. 1, the register set 122 is shown storing four packed dataelements, each of which consumes one quarter of the total bits of theregister.

The embodiment of FIG. 1 also includes a functional unit 130 thatoperates responsively to control signals. As will be further discussedbelow, the control signals may be composite signals comprising multiplebits or signal lines and/or may be micro operations or other outputsfrom circuitry such as a decoder, converter, translator, etc. As shown,the functional unit 130 may receive a control signal as indicated byarrow 135. In response to the control signal 135, the functional unitmay access one of the four packed data elements of the register 125. Theparticular one of the data elements to be accessed may be specified by aportion of the control signal. In the example shown, the element B isaccessed and routed to the functional unit 130 as shown by arrow 135′.The source element B may alternatively be retrieved from a memorylocation in some embodiments.

The functional unit converts the value B from the first format (F1) intoa plurality of values in the second format (F2). This plurality ofvalues is then stored in the second register 120 as shown by arrow 135″.The plurality of values each may correspond to a sub element of B (e.g.,B1, B2, B3, and B4) represented in a different format. In someembodiments, the value B from the register 125 may have sub elementssimply delineated by bit positions (e.g., bit positions 1 through N aresub element 1, bit positions N+1 through 2N are sub element 2, etc.). Inother embodiments, a particular conversion of the entire number intofour different components mathematically derived from the total numberis possible.

It may be advantageous to break down a set of smaller sub elements in afirst format into the same number of elements in a more expanded ordetailed format in a variety of applications. For example, pixel datamay comprise a number of components but pixels may be generallymanipulated or moved as a unit. Therefore, elements A, B, C and D inregister 125 may be individual pixels. It may be advantageous tomanipulate the sub elements of these pixels. Therefore, a convertoperation according to disclosed techniques can be used to extract thepixel sub element (component) information for further processing inanother format. Performing the conversion of all of the individual subelements of a pixel in response to a single control signal may greatlyexpedite pixel processing sequences in some cases.

Similarly, it may be advantageous to convert data such as pixel databack to a compact format after processing in the second format. As such,the functional unit 130 may perform such a conversion in response to asecond control signal as indicated by arrow 140. In response to thesecond control signal, the functional unit 130 retrieves the fourcomponents of the value B from the register 120 in the second format(arrow 140′), converts these four components into the first format, andstores the combined value (B) in the register 125 as indicated by arrow140″. In this case, a larger set of bits from each of multiple packeddata elements is reduced into a smaller set (fewer bits) and stored intoone position of a register that can hold multiple elements of a packeddata.

FIG. 2 a illustrates a more detailed view of a processor 200 accordingto one embodiment. FIG. 2 a also illustrates a memory 270 coupled to theprocessor 200. The memory 270 may be any of a wide variety of memories(including various layers of memory hierarchy) as are known or otherwiseavailable to those of skill in the art. The processor 200 follows aprogram sequence including at least one convert instruction. The convertinstruction enters a front end portion 210 and is processed by one ormore decoders 220. The decoder may generate as its output a microoperation such as a fixed width micro operation in a predefined format,or may generate other instructions, microinstructions, or controlsignals which reflect the original convert instruction. The front end210 also includes register renaming logic 225 and scheduling logic 230which generally allocate resources and queue the operation correspondingto the convert instruction for execution.

The processor 200 is shown including execution logic 250 having a set ofexecution units 255-1 through 255-N. Some embodiments may include anumber of execution units dedicated to specific functions or sets offunctions. Other embodiments may include only one execution unit or oneexecution unit that can perform a particular function. The executionlogic performs the operations specified by the convert instruction aswill be discussed further below with respect to FIG. 2 b.

Once execution of the specified operations completes, back end logic 260retires the instructions. In one embodiment, the processor 200 allowsout of order execution but requires in order retirement of instructions.Retirement logic 265 may take a variety of forms as known to those ofskill in the art (e.g., re-order buffers or the like).

FIG. 2 b illustrates further details of the interaction between anexecution unit 262 and a register file 268. The execution unit 262includes an arithmetic logic unit (ALU) 264 as well as saturationcircuitry 266. Depending on the conversion, the ALU may convert frominteger to floating point or vice versa according to the received microoperation or control signal. Also, depending on the operation, theinputs may be signed or unsigned, and the arithmetic may beappropriately adjusted.

In one embodiment, multiple ALU portions are available to performconversions in parallel or simultaneously. One ALU may be adapted tooperate on larger operands or on multiple smaller operands in parallel.Conversions are considered to be performed simultaneously whendispatched in a single clock cycle of the processor. For example, thefour conversions shown in FIG. 1 may be dispatched to ALU logic togetherto rapidly generate a result. In other embodiments, less logic circuitrymay be provided and accordingly the logic may be re-used by sequentiallyperforming one or more iterations of less than the full set ofconversions.

The conversion result may be saturated, for example in the event of aconversion from a floating point value to an integer value. A floatingpoint value typically is capable of representing a larger range ofvalues than an integer format using the same number of bits. Thefloating point values have even more potential to exceed the range of aninteger format if the floating point representation has a larger numberof bits than the integer format. Therefore, when converting fromfloating point to integer, it may be desirable to saturate the value,meaning that if the floating point value was beyond the range that theinteger format, then the corresponding extrema of the integer range isused. For example, if a floating point number is a negative numberbeyond the range of the integer format, then the smallest negativeinteger number is used under the process of saturation. Similarly, ifthe floating point number is a positive number that is greater than thehighest integer number available according to the integer number format,then the highest integer is used. Alternative techniques such aswrapping (ignoring higher order bits) or truncation (removing low orderbits) may be used in alternative embodiments.

FIG. 2 c illustrates one alternative implementation of a processor 293.In the embodiment of FIG. 2 c, a first module 295 receives (and/orfetches) instructions in a first Instruction Set Architecture (ISA) suchas a CISC ISA. A binary translation means 297 then converts theinstructions from the first ISA to a second ISA. The binary translationmeans 297 typically comprises a software program that converts from oneISA to another ISA. The binary translation software program may executeon a processor to convert the first ISA instructions to the second ISA.Alternatively, hardware, firmware, or mix of any of hardware, firmwareand software structures may be used to provide a translation layer.Execution resources for the second ISA 299 then execute the instructionsin the second ISA. The execution resources 299 may be the same resourcesthat execute the binary translation software program if a binarytranslation program is used.

FIG. 2 d illustrates one embodiment of an instruction format that may beused with disclosed conversion instructions. This format includes anopcode, a MOD R/M byte, and an immediate operand. The MOD R/M byteincludes a mod field (bits 7:6), a reg/opcode field (bits 5:3) and anr/m field (bits 2:0). The mod field combines with the r/m field to form32 possible values, eight registers and twenty four addressing modes.The reg/opcode field specifies either a register number or three morebits of opcode information. The purpose of the reg/opcode field isspecified in the primary opcode. The r/m field can specify a register asan operands or can be combined with the mod field to encode anaddressing mode. Thus, the MOD r/m field provides source and destinationspecifiers. In the case of a source memory operand, additional addressinformation is also specified in addition to the MOD r/m field. Ofcourse other formats of instructions may also be used as may beparticularly suitable to a particular implementation or application orto conform to a different ISA, and therefore other encodings may be usedas source and destination specifiers.

FIG. 2 e is a binary floating-point format used by one embodiment. Thisformat may conform to an IEEE standard (e.g., 854-1987 IEEE Standard forRadix-Independent Floating-Point Arithmetic 1987). The sign is a binaryvalue that indicates the number is positive (0) or negative (1). Thesignificand has two parts: a 1-bit binary integer, also referred to asthe J-bit; and, a binary fraction. In other embodiments, the J-bit isnot explicitly represented, but instead is an implied value. Theexponent is a binary integer that represents the base-2 power to whichthe significand is raised.

FIG. 3 a illustrates conversions performed according to one embodimentof a convert instruction. In this example, each arrow represents aninteger to floating point conversion. Therefore, in this example, eachsub element, B₁, G₁, R₁, A₁ the of second packed data element (B₁G₁R₁A₁)is converted into a floating point number, with each floating pointnumber taking up the same number of bits as the entire integer element.The four sub elements of the second packed data element in the sourceregister 310 are converted and stored in the destination register 320 asfour packed data elements in an order defined by the four sub elementpositions in the register 310.

The RGB & A labels for the data sub elements indicate that the data maybe integer representations of the red, green, blue, and alpha componentsof a pixel. In one embodiment, one byte dedicated to each of the RGBAcomponents is converted to a thirty-two bit floating pointrepresentation (may be referred to as “single precision” floating pointrepresentation). Thus, four eight-bit-bytes of the RBGA thirty-two-bitdata may be converted into four thirty-two bit floating point numbers.

In general, according to such an instruction, M sub elements of singleelement of a packed data that has M elements are converted, expanded andstored as M elements of a destination packed data storage location,where each element has a power-of-two multiple of the number of bits ofthe sub elements. For example, the elements may each have N bits, andthe sub elements may have N/M bits, where M is a power of two (i.e.,M=2^(K), where K is a positive integer value). It will be apparent toone of skill in the art that the widths of these elements may be scaledup. For example, each sub element may be sixteen or thirty-two bits andtherefore a pixel may encompass respectively sixty-four or one hundredand twenty-eight bits. The corresponding floating point numbers may beexpanded into two hundred fifty-six or five hundred and twelve bitregisters, or a different number of bits if a different number of bitsis used in the floating point representation. Additionally, as will beapparent with respect to further embodiments below, the number of packeddata elements and sub elements need not be the same.

In the embodiment shown in FIG. 3 a, the second packed data element(B₁G₁R₁A₁) is converted. The second element may be selected forconversion by providing an immediate operand to the convert instruction.The immediate operand can encode which of the packed data elements ofthe packed data should be converted. Other techniques such as specifyinga location by setting a value in another storage location (e.g., anotherregister) may also be used in some embodiments. Alternatively, adedicated convert instruction may be provided so that the opcodedirectly encodes which one of the several packed data elements toconvert.

For example, the embodiment of FIG. 3 b illustrates a conversion that issimilar to that of FIG. 3 a in that RGBA data from one element of afirst register 330 is converted and stored in the four elements of asecond register 340, except that the first element of the packed data isconverted. This may be accomplished by having a dedicated instructionthat automatically converts the first element in the source register.Another three dedicated instructions may be used to convert theremaining three elements of the packed data. However, another approachis to use shift instructions to shift data into the first position, andthen the dedicated instruction that automatically converts the firstelement in the source register may be used again to convert eachsubsequent element. This shift and convert approach advantageously usesfewer opcodes and avoids the use of immediates, but expands code byusing additional shift instructions.

FIG. 4 a illustrates conversions performed according to one embodimentof another convert instruction. In this example, each arrow represents afloating point to integer conversion. Each of the four components B₁,G₁, R₁, A₁ from a first register 410 is converted from floating pointformat to an integer format and stored as a sub element of one elementin a second register 420. In this case, the second element in theregister 420 is the destination for the sub elements. Which of theelements of the packed data becomes the destination for the four subelements may again be selected by an immediate operand provided with theinstruction, or may be established by the instruction itself or otherindirect means as previously discussed. The order of the four subelements within the selected element of the destination register 420 isdefined by the positions of the data elements in the source register410. As previously, RGBA data is merely illustrative of one type andformat of data that may be manipulated according to such instructions,and other forms or other types of data may be used.

FIG. 4 b illustrates an example similar to that of FIG. 4 a in that apacked data of multiple floating point numbers from a first register 430is converted to multiple integer sub elements of a packed data elementand stored in a subset of the locations of a second register 440.However, in the case of FIG. 4 b, the first element in the register 440is filled by the instruction. This may be the case where a differentimmediate operand is used or may be the case where a single dedicatedconversion instruction of this type is provided and shifts are reliedupon to move the data to other packed data element positions.

FIG. 5 illustrates conversions performed according to one embodiment ofanother convert instruction. The embodiment of FIG. 5 is similar to theembodiment of FIG. 4 a except that the data elements in integer form areof higher precision. In this example, each arrow represents a floatingpoint to integer conversion. Therefore, in the embodiment of FIG. 5, theRGBA components in floating point format are read from a first register510, converted from floating point to integer, and stored in a secondregister 520. Again, the positioning in the destination register may bespecified as previously discussed.

In the embodiment of FIG. 5, each RGBA pixel in the destination consumesone half of the destination register 520 because each of the individualsub elements has one half of the number of bits as the floating pointrepresentation. For example, in one embodiment, each of the integercomponents is sixteen bits, and each floating point component is asingle precision floating point number having thirty-two bits. Inanother embodiment, each integer component may be thirty-two bits andeach floating point value may be sixty-four bits (e.g., with two hundredand fifty six bit registers). Various other permutations will beapparent to those of skill in the art.

FIG. 6 illustrates conversions performed according to one embodiment ofanother convert instruction. In this example, each arrow represents aninteger to floating point conversion. Each of the four components B₁,G₁, R₁, A₁ from one element of a first register 610 is converted fromfloating point format to an integer format and stored as a sub elementof one element in a second register 620. In this case, the secondelement in the register 620 is the destination for the sub elements.Which of the elements of the packed data becomes the destination for thefour sub elements may again be selected by an immediate variableprovided with the instruction, or may be established by the instructionitself or other indirect means as previously discussed. The order of thefour sub elements within the selected element of the destinationregister 620 is defined by the positions of the data elements in thesource register 610.

The example of FIG. 6 is similar to that of FIG. 3 a except that thedata elements in integer form are of higher precision. Therefore, onlytwo pixels are stored in a single register, and one of the two pixelsmay be expanded to fill the entire destination register. In oneembodiment, each of the integer components is sixteen bits, and eachfloating point component is a single precision floating point numberhaving thirty-two bits. In another embodiment, each integer componentmay be thirty-two bits and each floating point value may be sixty-fourbits (e.g., with two hundred and fifty six bit registers). Various otherpermutations will be apparent to those of skill in the art.

The following table summarizes one example set of conversioninstructions.

Example Instructions

Mnemonic Function Size Src Reg Src Size Dst Reg Dst CVTB2PS Convert Byteto 4 8 bit Xmm 4 32 bit Xmm Packed Single integers or m32 FP PrecisionFloating-Point Value CVTUB2PS Convert Unsigned 4 8 bit Xmm 4 32 bit XmmByte to Packed Single unsigned or m32 FP Precision Floating-Pointintegers Value CVTW2PS Convert Word to 4 16 bit Xmm 4 32 bit Xmm PackedSingle integers SP FP Precision Floating-Point Value CVTUW2PS ConvertUnsigned 4 16 bit Xmm 4 32 bit Xmm Word to Packed unsigned SP FP SinglePrecision integers Floating-Point Value CVTPS2PB Convert Packed 4 32 bitXmm 4 8 bit Xmm Single Precision SP FP or m128 integers Floating-PointValue to Word (with saturation or different rounding mode versions)CVTPS2UPW Convert Packed 4 32 bit Xmm 4 16 bit Xmm Single Precision SPFP unsigned Floating-Point Value integers to Unsigned Word (withsaturation or different rounding mode versions)

Example of Convert Byte to Packed Single Precision Floating Point

CVT[U]B2PS xmm1, xmm2/m128, imm8 if (imm8 == 0) {  //convert xmm2 pixel0's r,g,b,a channels to SP FP  DEST[31-0] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[7-0]); DEST[63-32] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[15-8]); DEST[95-64] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[23-16]); DEST[127-96] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[31-24]); } elseif (imm8 == 1) {  //convert xmm2 pixel 1's r,g,b,a channels to SP FP DEST[31-0] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[39-32]); DEST[63-32] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[47-40]); DEST[95-64] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[55-48]); DEST[127-96] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[63-56]); } elseif (imm8 == 2) {  //convert xmm2 pixel 2's r,g,b,a channels to SP FP DEST[31-0] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[71-64]); DEST[63-32] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[79-72]); DEST[95-64] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[87-80]); DEST[127-96] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[95-88]); } elseif (imm8 == 3) {  //convert xmm2 pixel 3's r,g,b,a channels to SP FP DEST[31-0] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[103-96]); DEST[63-32] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[111-104]); DEST[95-64] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[119-112]); DEST[127-96] =Convert_Integer_To_Single_Precision_Floating_Point(SRC[127-120]); }

Example of Convert Word to Packed Single Precision Floating Point

CVT[U]W2PS xmm1, xmm2/m128, imm8 if (imm8 == 0) {  //convert xmm2 pixel0's r,g,b,a channels to SP FP  DEST[31-0] = Convert_Integer_To_Single_Precision_Floating_Point(SRC[15-0]); DEST[63-32] = Convert_Integer_To_Single_Precision_Floating_Point(SRC[31-16]); DEST[95-64] = Convert_Integer_To_Single_Precision_Floating_Point(SRC[47-32]); DEST[127-96] = Convert_Integer_To_Single_Precision_Floating_Point(SRC[63-48]); } elseif (imm8 == 1) {  //convert xmm2 pixel 1's r,g,b,a channels to SP FP DEST[31-0] = Convert_Integer_To_Single_Precision_Floating_Point(SRC[79-64]); DEST[63-32] = Convert_Integer_To_Single_Precision_Floating_Point(SRC[95-80]); DEST[95-64] =  Convert_Integer_To_Single_Precision_Floating_Point- (SRC[111-96]);  DEST[127-96] = Convert_Integer_To_Single_Precision_Floating_Point-  (SRC[127-112]); }

CVTPS2[U]PB xmm1/m128, xmm2, imm8 if (imm8 == 0) {  //convert xmm2 pixel0's r,g,b,a channels to SP FP  DEST[7-0] =Convert_Single_Precision_Floating_Point_To_Integer (SRC[31-0]); DEST[15-8] = Convert_Single_Precision_Floating_Point_To_IntegerSRC[63-32]);  DEST[23-16] =Convert_Single_Precision_Floating_Point_To_Integer(SRC[95-64]); DEST[31-24] =Convert_Single_Precision_Floating_Point_To_Integer(SRC[127-96]); } elseif (imm8 == 1) {  //convert xmm2 pixel 1's r,g,b,a channels to SP FP DEST[39-32] = Convert_Single_Precision_Floating_Point_To_Integer(SRC[31-0]);  DEST[47-40] =Convert_Single_Precision_Floating_Point_To_Integer SRC[63-32]); DEST[55-48] =Convert_Single_Precision_Floating_Point_To_Integer(SRC[95-64]); DEST[63-56] =Convert_Single_Precision_Floating_Point_To_Integer(SRC[127-96]); } elseif (imm8 == 2) {  //convert xmm2 pixel 2's r,g,b,a channels to SP FP DEST[71-64] = Convert_Single_Precision_Floating_Point_To_Integer(SRC[31-0]);  DEST[79-72] =Convert_Single_Precision_Floating_Point_To_Integer SRC[63-32]); DEST[87-80] =Convert_Single_Precision_Floating_Point_To_Integer(SRC[95-64]); DEST[95-88] =Convert_Single_Precision_Floating_Point_To_Integer(SRC[127-96]); } elseif (imm8 == 3) {  //convert xmm2 pixel 3's r,g,b,a channels to SP FP DEST[103-96] = Convert_Single_Precision_Floating_Point_To_Integer(SRC[31-0]);  DEST[111-104] =Convert_Single_Precision_Floating_Point_To_Integer SRC[63-32]); DEST[119-112] =Convert_Single_Precision_Floating_Point_To_Integer(SRC[95-64]); DEST[127-120] =Convert_Single_Precision_Floating_Point_To_Integer(SRC[127-96]); }

CVTPS2[U]PW xmm1/m128, xmm2, imm8 if (imm8 == 0) {  //convert xmm2 pixel0's r,g,b,a channels to SP FP  DEST[15-0] = Convert_Single_Precision_Floating_Point_To_Integer (SRC[31-0]); DEST[31-16] =  Convert_Single_Precision_Floating_Point_To_IntegerSRC[63-32]);  DEST[47-32] = Convert_Single_Precision_Floating_Point_To_Integer(SRC[95-64]); DEST[63-48] =  Convert_Single_Precision_Floating_Point_To_Integer- (SRC[127-96]); } else if (imm8 == 1) {  //convert xmm2 pixel 1'sr,g,b,a channels to SP FP  DEST[79-64] = Convert_Single_Precision_Floating_Point_To_Integer (SRC[31-0]); DEST[95-80] =  Convert_Single_Precision_Floating_Point_To_IntegerSRC[63-32]);  DEST[111-96] = Convert_Single_Precision_Floating_Point_To_Integer(SRC[95-64]); DEST[127-112] =  Convert_Single_Precision_Floating_Point_To_Integer- (SRC[127-96]); }

FIG. 7 a illustrates one alternative convert instruction that addsfurther functionality to the single instruction. Such an embodiment maybe useful to further reduce code size when multiple instantiations ofthe single-element convert instructions are commonly used to convert toand from a full register of SIMD values. In the embodiment of FIG. 7 a,four values (e.g., pixel values) stored in a first register 710 areconverted and stored into four separate registers 720, 725, 730 and 735.While these conversions are done in response to a single instruction(e.g., macroinstruction) in this example, in some cases insufficientparallel hardware may be available to perform the conversions inparallel. Therefore, multiple micro operations may be generated inresponse to such a macroinstruction and conversion hardware may be usedserially to perform the sixteen conversions.

In the embodiment of FIG. 7 a, each arrow represents an integer tofloating point conversion. Thus, a first data element (B₀G₀R₀A₀) ininteger format in the source register 710 is converted into fourfloating point values in the destination register 735. Ordering of theelements again follows the source sub elements. Moreover, a variety ofsizes of the elements and sub elements may be used as previouslydiscussed. Likewise, a second data element (B₁G₁R₁A₁) in integer formatin the source register 710 is converted into four floating point valuesin the destination register 730, a third data element (B₂G₂R₂A₂) ininteger format in the source register 710 is converted into fourfloating point values in the destination register 725, and a fourth dataelement (B₃G₃R₃A₃) in integer format in the source register 710 isconverted into four floating point values in the destination register720.

FIG. 7 b illustrates a converse case of FIG. 7 a, in which fourregisters containing floating point values are compacted into a singleregister containing integer values. Thus, in the embodiment of FIG. 7 b,each arrow represents a floating point to integer conversion. Fourseparate floating point values B₀, G₀, R₀, A₀ from a first sourceregister 750 are converted to integer format and stored in the firstelement position of a destination register 770. Likewise, the fourseparate floating point values B₁, G₁, R₁, A₁ from a second sourceregister 755 are converted to integer format and stored in the secondelement position of the destination register 770, the four separatefloating point values B₂, G₂, R₂, A₂ from a third source register 760are converted to integer format and stored in the third element positionof the destination register 770, and the four separate floating pointvalues B₃, G₃, R₃, A₃ from a fourth source register 765 are converted tointeger format and stored in the fourth element position of thedestination register 770.

FIG. 8 a illustrates operations for another convert instruction similarto that of FIG. 7 a except that the integer elements are larger inproportion to the floating point elements than in FIG. 7 a. To be clear,each arrow in FIG. 8 a represents an integer to floating pointconversion. A first element (B₀G₀R₀A₀) of the packed data stored in asource register 810 in integer format is converted to floating pointvalues and stored in a first destination register 830. A second element(B₁G₁R₁A₁) of the packed data stored in the source register 810 ininteger format is converted to floating point values and stored in asecond destination register 820. Both conversions are done in responseto a single instruction in this embodiment, and the ordering of theelements in the respective destination registers follows the ordering ofthe source sub elements.

FIG. 8 b illustrates operations for another convert instruction similarto that of FIG. 7 b except that the integer elements are larger inproportion to the floating point elements than in FIG. 7 b. Each arrowin FIG. 8 b represents floating point to integer conversion. Fourseparate floating point values B₀, G₀, R₀, A₀ from a first sourceregister 860 are converted to integer format and stored in the firstelement position of a destination register 870. Likewise, the fourseparate floating point values B₁, G₁, R₁, A₁ from a second sourceregister 850 are converted to integer format and stored in the secondelement position of the destination register 870 Both conversions aredone in response to a single instruction in this embodiment, and theordering of the sub elements in the destination register follows theordering of the source elements.

In many of the above examples, the source and destination storagelocations have the same size. In fact, the source and destination mayboth be registers in a single set of architectural registers (e.g., thexmm registers in a processor like Intel's Pentium® Processors). However,in other embodiments, the source and destination registers need not beof the same size or in the same register set. It may be advantageous insome cases to use a floating point register set that has more bits thanthe integer register set.

FIG. 9 illustrates one embodiment of a system utilizing disclosedconversion techniques. In this embodiment, a processor 900 is coupled toa memory controller 990. The memory controller may be a componentintegral with the processor 900 or may be a discrete component indifferent embodiments. The memory controller 990 is coupled by a bus 992to a main memory 994. The bus may be any communication bus including butnot limited to any one or more of a parallel signaling bus, a serialbus, a multidrop bus, a point-to-point bus, etc. The main memoryincludes a first convert sequence 995, a pixel manipulation sequence996, a second convert sequence 997, and a display sequence 998.

The processor 900 includes front end logic 910, execution logic 920,which includes a plurality of ALU circuits 925-1 through 925-N, and backend logic 930. The processor 900 executes instruction sequences fetchedfrom the memory such as the first convert sequence 995, the pixelmanipulation sequence 996, the second convert sequence 997 and thedisplay sequence 998. The system also includes a communication/networkinterface 950. The interface 950 is operatively coupled to the processor900 such that the processor can send commands to the interface 950 andsend and receive data via a network (may be a wired or wireless network)or communications medium. The interface may receive any one or more ofthe sets of software sequences in electronic format. In anyrepresentation of the software sequence, the instructions may be storedor transmitted in any form of a machine readable medium. An optical orelectrical wave modulated or otherwise generated to transmit suchinformation, a memory, or a magnetic or optical storage such as a discmay be the machine readable medium. Any of these mediums may store orcarry the instruction information.

The system also includes a graphics interface 955 with a frame buffer957 and a display unit 960. The graphics interface 955 is operativelycoupled to the processor (may be one or more interface or bridgecomponents involved in this coupling) such that the processor can sendcommands and data to the graphics interface 955. Image data may bewritten to the frame buffer 957 to cause the data to be displayed by thedisplay 960 in some embodiments.

Further operations of the system of FIG. 9 may be appreciated withrespect to the flow diagram of FIG. 10. As indicated in block 1010, aset of pixels (e.g., N pixels) are converted from SIMD integer format toSIMD floating point format. This conversion may be accomplished in theembodiment of FIG. 9 by the processor 900 executing the first convertsequence 995. The first convert sequence may include N convertinstructions such as those of FIGS. 3 a, 3 b and 6 or may include asingle convert instruction such as shown in FIG. 7 a or 8 a. The convertinstruction(s) store the resulting converted values into architecturalregisters as indicated in block 1020. For example, four convertinstructions may be used to convert four packed data elements in asingle register in embodiments similar to the embodiment shown in FIGS.3 a and 3 b.

In some cases, the converted values may be directly operated on in placeafter conversion. Optionally, the now converted pixel values in floatingpoint format may be moved as indicated in block 1030. The pixels may bemoved to other locations for manipulation or temporary storage prior tomanipulation. Some of the destination values may be moved during theconversion process prior to execution of all N conversions to limit thenumber of registers used in the N pixel conversion process.

As indicated in block 1040, floating point operations may be performedon the pixel values. A great variety of different pixel manipulationtechniques are known to those of skill in the art. An appropriateroutine depends on the effect that is sought as will be apparent tothose of skill in the art. However, the conversion process to and fromfloating point may be accomplished more efficiently using disclosedtechniques.

Once the desired manipulations have been accomplished, then resultingfloating point values may be converted back. As indicated in block 1050,the N pixels are converted from their SIMD floating point format back toSIMD integer format in response to one or more convert instructions. Thesecond conversion routine 497, similarly to the first conversionroutine, may accomplish this conversion back with a sequence of Ninstructions (e.g., embodiments of FIGS. 4 a, 4 b, 5) or with a singleinstruction (e.g., embodiments of FIGS. 7 b, 8 b).

Finally, the pixels may be displayed as indicated in block 1060. Thedisplay sequence 998 may include instructions to move the pixel data tothe frame buffer 957 or may include other appropriate instructions todisplay a pixel for a particular system.

One example optimized instruction sequence using disclosed convertinstructions is shown in Table 2, below. As can be readily appreciatedfrom this example, the new convert instructions can lead to much shorterand in some case more rapidly executed code for some sequences.

TABLE 2 Example Instruction Sequence Improvement Old Sequence NewSequence _asm { _asm { pxor xmm0, xmm0 //ZEROI // movdqu xmm7, SRCmovdqu xmm7, SRC movdqa xmm6, xmm7 // Punpcklbw xmm7, xmm0 //P //Punpckhbw xmm6, xmm0 //Q // movdqa xmm5, xmm7 // movdqa xmm4, xmm6 //Punpcklwd xmm7, xmm0 //P0 // Punpckhwd xmm5, xmm0 //P1 // Punpcklwdxmm6, xmm0 //P2 // Punpckhwd xmm4, xmm0 //P3 // cvtdq2ps xmm3, xmm7 //F0cvtb2ps xmm3, xmm7, 0 //F0 cvtdq2ps xmm2, xmm5 //F1 cvtb2ps xmm2, xmm5,1 //F1 cvtdq2ps xmm1, xmm6 //F2 cvtb2ps xmm1, xmm7, 2 //F2 movdqa F0,xmm3 movdqa F0, xmm3 movdqa F1, xmm2 movdqa F1, xmm2 cvtdq2ps xmm3, xmm4//F3 cvtb2ps xmm3, xmm7, 3 //F3 movdqa F2, xmm1 movdqa F2, xmm1 movdqaF3, xmm3 movdqa F3, xmm3 } }

A processor design may go through various stages, from creation tosimulation to fabrication. Data representing a design may represent thedesign in a number of manners. First, as is useful in simulations, thehardware may be represented using a hardware description language oranother functional description language Additionally, a circuit levelmodel with logic and/or transistor gates may be produced at some stagesof the design process. Furthermore, most designs, at some stage, reach alevel of data representing the physical placement of various devices inthe hardware model. In the case where conventional semiconductorfabrication techniques are used, the data representing the hardwaremodel may be the data specifying the presence or absence of variousfeatures on different mask layers for masks used to produce theintegrated circuit. In any representation of the design, the data may bestored in any form of a machine readable medium. An optical orelectrical wave modulated or otherwise generated to transmit suchinformation, a memory, or a magnetic or optical storage such as a discmay be the machine readable medium. Any of these mediums may “carry” or“indicate” the design or software information. When an electricalcarrier wave indicating or carrying the code or design is transmitted,to the extent that copying, buffering, or re-transmission of theelectrical signal is performed, a new copy is made. Thus, acommunication provider or a network provider may make copies of anarticle (a carrier wave) embodying techniques of the present invention.

Thus, techniques for parallel data conversions are disclosed. Whilecertain exemplary embodiments have been described and shown in theaccompanying drawings, it is to be understood that such embodiments aremerely illustrative of and not restrictive on the broad invention, andthat this invention not be limited to the specific constructions andarrangements shown and described, since various other modifications mayoccur to those ordinarily skilled in the art upon studying thisdisclosure. In an area of technology such as this, where growth is fastand further advancements are not easily foreseen, the disclosedembodiments may be readily modifiable in arrangement and detail asfacilitated by enabling technological advancements without departingfrom the principles of the present disclosure or the scope of theaccompanying claims.

What is claimed is:
 1. A system comprising: a processor comprising aregister file including a first packed data register and a second packeddata register, a decoder to decode a first instruction, scheduling logicto allocate resources and queue operations corresponding to the firstinstruction for execution, and execution logic coupled to the decoderand the scheduling logic, wherein, responsive to the decoder decodingthe first instruction, the execution logic is to convert a plurality offirst packed signed data elements to a plurality of unsigned results,wherein the plurality of first packed signed data elements from thefirst packed data register is converted to the plurality of unsignedresults, the unsigned results are saturated and stored in the secondpacked data register, and each of the first packed signed data elementshas a first number of bits, each of the unsigned results has a secondnumber of bits, and the second number of bits is one half the firstnumber of bits; a memory controller coupled to the processor, whereinthe memory controller is integral with the processor; a communicationinterface to a wireless network, the communication interface coupled tothe processor; and a graphics interface to a display, the graphicsinterface coupled to the processor.
 2. The system of claim 1, whereinthe first number of bits is 32 and the second number of bits is
 16. 3.The system of claim 1, wherein the first number of bits is 64 and thesecond number of bits is
 32. 4. The system of claim 1, wherein theprocessor further comprises register renaming logic to associatephysical registers with architectural registers.
 5. A system comprising:a processor comprising a register file including a first packed dataregister and a second packed data register, a decoder to decode a firstinstruction, scheduling logic to allocate resources and queue operationscorresponding to the first instruction for execution, and executionlogic coupled to the decoder and the scheduling logic, wherein,responsive to the decoder decoding the first instruction, the executionlogic is to convert a plurality of first packed integer data elements toa plurality of integer results, wherein the plurality of first packedinteger data elements from the first packed data register is convertedto the plurality of integer results, the integer results are saturatedand stored in the second packed data register, and each of the firstpacked integer data elements has a first number of bits, each of theinteger results has a second number of bits, and the second number ofbits is one half the first number of bits; a memory controller coupledto the processor, wherein the memory controller is integral with theprocessor; a communication interface to a wireless network, thecommunication interface coupled to the processor; and a graphicsinterface to a display, the graphics interface coupled to the processor.6. The system of claim 5, wherein the first number of bits is 32 and thesecond number of bits is
 16. 7. The system of claim 5, wherein the firstnumber of bits is 64 and the second number of bits is
 32. 8. The systemof claim 5, wherein the processor further comprises register renaminglogic to associate physical registers with architectural registers.